﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DTO;
using BUS;
using QLDT.Report;

namespace QLDT
{
    public partial class frm_report_DeTai : DevExpress.XtraEditors.XtraForm
    {
        public frm_report_DeTai()
        {
            InitializeComponent();
        }
        private void LoadThongtin()
        {
            //gridLookUp_MaLoaiDT
            gridLookUp_MaLoaiDT.EditValue = null;
            gridLookUp_MaLoaiDT.Properties.View.OptionsBehavior.AutoPopulateColumns = false;
            gridLookUp_MaLoaiDT.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
            gridLookUp_MaLoaiDT.Properties.ValueMember = "MaLoaiDT";
            gridLookUp_MaLoaiDT.Properties.DisplayMember = "MaLoaiDT";
            gridLookUp_MaLoaiDT.Properties.View.BestFitColumns();
            gridLookUp_MaLoaiDT.Properties.PopupFormWidth = 400;
            gridLookUp_MaLoaiDT.Properties.NullText = "Chọn loại đề tài";
            gridLookUp_MaLoaiDT.Properties.DataSource = BUS_LoaiDT.selectLoaiDeTai();
        }
        public void load()
        {
            try
            {
                string loaidt = gridLookUp_MaLoaiDT.Text;

                if (gridLookUp_MaLoaiDT.Text == "Tất cả")
                {
                    loaidt = "%";
                }
               
                // DTO_SinhVien SV = new DTO_SinhVien();
                List<DTO_DeTai> dt = BUS_DeTai.ChonDT_TheoLoaiDT(loaidt);
                rpt_DSDeTai cr = new rpt_DSDeTai();
                cr.SetDataSource(dt);
                crystalReportdetai.ReportSource = cr;
            }
            catch { }
        }
        private void frm_report_DeTai_Load(object sender, EventArgs e)
        {
            LoadThongtin();
        }

        private void gridLookUp_MaLoaiDT_EditValueChanged(object sender, EventArgs e)
        {
            load();
        }
    }
}